package com.eagle.roomcrawler.controller;

import com.eagle.roomcrawler.entity.Url;
import com.eagle.roomcrawler.entity.User;
import com.eagle.roomcrawler.mapper.UserMapper;
import com.eagle.roomcrawler.urlmanager.UrlManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class UrlController {

    @Autowired
    private UrlManager urlManager;

    @RequestMapping(value="/configUrl")
    @ResponseBody
    public String configUrl(Url url ) {
        System.out.println(url.toString());

        String result = urlManager.configUrl(url);

        if(result.equals("ENABLED")){//配置成功
            return "配置URL成功，正在爬取数据";
        }else{
            return "配置URL失败，该URL不可用，请检查该URL";
        }

    }
}
